/**
 * Created with JetBrains WebStorm.
 * User: Tomer
 * Date: 1/15/13
 * Time: 10:48 PM
 * To change this template use File | Settings | File Templates.
 */
var app = angular.module('SaftalkMobile', []);

app.config(function($routeProvider, $locationProvider) {
    $locationProvider.html5Mode(false);
    $routeProvider
        .when('/chat', {templateUrl: '#chat'})
    .when('/login', {templateUrl: '#login'})
    .when('/main', {templateUrl: '#main'})
    .when('/survey', {templateUrl: '#survey'})
        .otherwise({redirectTo: '/main'});
});

app.directive('fitText', function() {
    console.log('fitText');
    var def={
        link : function(scope, element, attrs) {
            var scale=1;
            if (attrs.fitText!=""){
                scale=attrs.fitText;
            }
            $(element).fitText(scale);
        }};
    return def;
});

app.directive('coolFade', function() {
    var def={
        compile: function(elm) {
            //console.log('compiling');
            $(elm).css('opacity', 0);
            return function(scope, elm, attrs) {
                //   console.log('animating');
                $(elm).animate({
                    opacity: 1
                }, 1100);
            };
        }
    };
    return def;
});


function MobileCtrl($scope){


}

changePage = function(pageName){

    $location.path('/'+pageName);
}